/*  
   File Browser for SalesForce
   Copyright (c) 2009  Daniel Jordan
  
   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License
   as published by the Free Software Foundation; either version 2
   of the License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
 */

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SFFileBrowser
{
    public partial class frmLogin : Form
    {
        public frmLogin()
        {
            InitializeComponent();
            loadSettings();
        }

        private void buttonLogin_Click(object sender, EventArgs e)
        {
            this.Hide();
        }

        private void frmLogin_Activated(object sender, System.EventArgs e)
        {
            this.checkSave.Checked = false;

            if (this.textSFUser.Text.Length == 0)
            {
                textSFUser.Focus();
            }
            else
            
            this.textSFPassword.Focus();
        }

        public void saveSettings()
        {
            if (this.checkSave.Checked)
            {
                Properties.Settings.Default.SalesForce_Token = this.textSFToken.Text;
                Properties.Settings.Default.SalesForce_Username = this.textSFUser.Text;
                Properties.Settings.Default.Save();
            }
        }

        private void loadSettings()
        {
            
            this.textSFToken.Text = Properties.Settings.Default.SalesForce_Token;
            this.textSFUser.Text = Properties.Settings.Default.SalesForce_Username;


        }

        public string UserName
        {
            get { return this.textSFUser.Text; }
        }
        public string Password
        {
            get { return this.textSFPassword.Text; }
        }
        public string Token
        {
            get { return this.textSFToken.Text; }
        }

        public void ClearPassword()
        {
            this.textSFPassword.Text = "";
        }

        private void textSFToken_TextChanged(object sender, EventArgs e)
        {

        }

        private void frmLogin_Load(object sender, EventArgs e)
        {

        }


    }
}